import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * @Description TODO
 * @Author hhy
 * @Date 2020/10/19 10:19
 */
public class Test01 {
    public static void main(String[] args) throws IOException {
        File file = new File("a.txt");
        if (!file.exists()) file.createNewFile();
        FileOutputStream fos = new FileOutputStream(file,true);
        fos.write("啊这".getBytes("UTF-8"));

        FileInputStream fis = new FileInputStream(file);


        StringBuilder sb = new StringBuilder();
        byte[] bytes = new byte[1024];

        int n = 0;
        while ((n = fis.read())!=-1){
            sb.append((char)n);
        }

        System.out.println(sb.toString());

        fos.close();
        fis.close();

    }
}
